
<body>

    <div class="warp">
        <!--header-->
        <header class="hd fixed">
            <a href="<?php echo $base_url; ?>home/order/shoppingCar" class="r-icon shop-car-box">
            <i class="iconfont icon-icon"></i>      
			<span class="num none"></span>			      
            <span>购物车</span> 
        </a>
            <a href="<?php echo $base_url; ?>home/account/myInfo" class="l-icon">
            <i class="iconfont icon-wode"></i>   
            <span>我的</span>      
        </a>
            <p class="tit">
                <!--养悦源-->
				<img src="/static/dist/images/logo.png" alt="">
            </p>
        </header>
        <!--banner-->
        <div class="ban">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide">
                        <a href="#123">
                            <img src="/static/dist/images/m_banner.jpg" alt="">
                        </a>
                    </div>                  
                </div>
                <!-- Add Pagination -->
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <!--tit-bar-->
        <div class="tit-bar">
            <img class="zero-icon" src="/static/dist/images/zero-icon.png" alt="">
        </div>
        <!--prod-list-->
        <div class="prod-list">
            <ul>
                <?php if(!empty($info)){foreach($info as $key => $value){?>
                <li>
                    <a href="<?php echo $base_url; ?>home/goods/goodsDetail?goods_id=<?php echo $value['goods_id'];?>">
                        <div class="prod_img">
                            <img src="<?php echo $base_path.$value['img_path'];?>" alt="<?php echo $value['img_name']?>">
                        </div>
                        <div class="prod_msg">
                            <p class="tit">
                                <?php echo $value['name'];?>
                            </p>
                            <p class="ms-tit">
                                <?php echo $value['other_name'];?>
                            </p>
                            <div class="price">
                                <span class="price-icon">
                                <img src="/static/dist/images/price-icon.jpg" alt="">
                            </span>
                                <div class="val">
                                    <span>¥</span><?php echo $value['price'];?>
                                </div>
                            </div>
                            <!--<p class="msg">
                                <?php echo $value['descript'];?>
                            </p>-->
                        </div>
                    </a>
                    <a class="shop_btn" href="<?php echo $base_url; ?>home/goods/goodsDetail?goods_id=<?php echo $value['goods_id'];?>">
                        立即购买
                    </a>
                </li>
                <?php }}?>
            </ul>

        </div>


    </div>

    <script src="/static/dist/js/base.js"></script>
    <script src="/static/dist/js/lib/swiper.jquery.min.js"></script>    
	<!--<script src="/static/dist/js/lib/store.legacy.min.js"></script>-->
    <script>
        // 矫正rem
        function correctrem() {
            var rem_full_width = $("<div id='rem-test' style='width:7.5rem'></div>").appendTo($('body')).width();
            var device_width = Math.min(document.documentElement.clientWidth, 640);
            if (rem_full_width !== device_width) {
                document.documentElement.style.fontSize = (device_width / 7.5) * (device_width / rem_full_width) + 'px';
            }
            $('#rem-test').remove();
        }
        correctrem();
        $(function () {
            var swiperSlide = $('.swiper-container').find('.swiper-slide');
            if (swiperSlide.length > 2) {
                var swiper = new Swiper('.swiper-container', {
                    pagination: '.swiper-pagination',
                    paginationClickable: true
                });
            }
        })

		// var cartData = store.get('cartData') || [];
		var cartData = getCookie('cartData') || [];
		if(cartData && cartData.length!=0){
				var sum = 0;
                for (var i = 0;i < cartData.length; i++){
					
					sum += parseInt(cartData[i].quantity);
                    // if(cartData[i].id == getQueryString("goods_id")){
                    //     if(cartData[i].quantity){
                    //          $(".shop-car-box").find('.num').removeClass('none').text(cartData[i].quantity);
                    //     }
                    // }                                       
			}               
			if(sum>=100){
				sum = '99+'
			}
			$(".shop-car-box").find('.num').removeClass('none').text(sum);
		}

		function setCookie(cname, cvalue, exdays) {
			cvalue = JSON.stringify(cvalue)

			var d = new Date();
			d.setTime(d.getTime() + (exdays*60*60*1000));
			var expires = "expires="+d.toUTCString();
			document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";  
		}
        function getCookie(cname) {
			var name = cname + "=";
			var ca = document.cookie.split(';');
			for(var i=0; i<ca.length; i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1);
				if (c.indexOf(name) != -1){
					return JSON.parse(c.substring(name.length, c.length));
				} 
			}
			return "";
		}
    </script>

</body>

</html>
